let state = {
  id: "",
  type: "",
  name: "",
  path: "",
};
let getters = {
  id: (state) => state.id,
  type: (state) => state.type,
  name: (state) => state.name,
  path: (state) => state.path,
};
let mutations = {
  reset(state, preview) {
    //初始化
    state.id = preview.id;
    state.type = preview.type;
    state.name = preview.name;
    state.path = preview.path;
  },
  setType(state, type) {
    // 设置类型
    state.type = type;
  },
  setName(state, name) {
    // 设置名称
    state.name = name;
  },
  setPath(state, path) {
    // 设置域名
    state.path = path;
  },
};
let actions = {
  testActions({ commit }, num) {
    setTimeout(() => {
      commit("setTotal", num);
      console.log(num);
    }, 2000);
  },
};
export default { state, getters, mutations, actions };
